
<%@ page import="com.demo1220.entity.Person" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %><%--
  Created by IntelliJ IDEA.
  User: WuLiangHang
  Date: 2021/12/20
  Time: 11:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    Person p = new Person();
    p.setName("小明");
    p.setPhones(new String[]{"123","456","234"});
    ArrayList<String> citys = new ArrayList<>();
    citys.add("北京");
    citys.add("上海");
    citys.add("深圳");
    p.setCities(citys);
    Map<String, Object> map=new HashMap<>();
    map.put("key1","value1");
    map.put("key2","value1");
    map.put("key3","value1");
    p.setMap(map);

    pageContext.setAttribute("person", p);
%>
输出 Person ：${person} <br/>
输出 Person 的 name 属性：${person.name} <br/>
输出 Person 的 phones[1] 属性：${person.phones[1]} <br/>
输出 Person 的 cities 属性：${person.cities} <br/>
输出 Person 的 cities第0个 属性：${person.cities.get(0)} <br/>
输出 Person 的 map 属性：${person.map} <br/>
输出 Person 的 map key = key1 属性：${person.map.get("key1")} <br/>
<%
    p.setPhones(new String[]{});
    citys.clear();
    map.clear();
%>
empty判断：<br>
 空字符串：${empty ""}
 null值：${empty null}
 空数组：${empty person.phones}
 空集合：${empty person.cities}
 空map：${empty person.map}

</body>
</html>
